# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

Category.delete_all
Category.create(name: 'Android', description: 'This is a description')
Category.create(name: 'Development', description: 'This is a description')
Category.create(name: 'Ruby', description: 'This is a description')
Category.create(name: 'Ruby on Rails', description: 'This is a description')
Category.create(name: 'Unix', description: 'This is a description')
Category.create(name: 'PHP', description: 'This is a description')
Category.create(name: 'Addons', description: 'This is a description')

Product.delete_all

Product.create(
  title: 'Metaprogramming Ruby: Program Like the Ruby Pros',
  description: %{
    As a Ruby programmer, you already know how much fun it is. 
    Now see how to unleash its power, digging under the surface and exploring the language most 
    advanced features: a collection of techniques and tricks known as metaprogramming. 
    Once the domain of expert Rubyists, metaprogramming is now accessible to programmers of 
    all levels from beginner to expert. Metaprogramming Ruby explains metaprogramming concepts in a 
    down-to-earth style and arms you with a practical toolbox that will help you write great Ruby code.
  },
  image_url: '/assets/books/meta.jpg',
  price: 18.95,
  category_id: Category.find_by_name('Ruby').id
)

Product.create(
  title: 'Programming Ruby 1.9 (3rd edition): The Pragmatic Programmers',
  description: %{
    Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox.
    This book is the only complete reference for Ruby 1.9, the very latest version of Ruby. (If you are still using Ruby 1.8, you will want to check out the original PickAxe.)
    2010 marks the 10th anniversary since the first edition of the PickAxe. We are proud that throughout its history, we have continued to cover the latest version of Ruby.
  },
  image_url: '/assets/books/ruby.jpg',
  price: 22.95,
  category_id: Category.find_by_name('Ruby').id,
  promote: true
)

Product.create(
  title: 'Everyday Scripting with Ruby: for Teams, Testers, and You',
  description: %{
    test bla bla
  },
  image_url: '/assets/books/everyday.jpg',
  price: 40.00,
  category_id: Category.find_by_name('Ruby').id
)

Product.create(
  title: 'Rails Recipes: Rails 3 Edition',
  description: %{
    Thousands of developers have used the first edition of Rails Recipes to solve the hard problems. 
    Now, five years later, it s time for the Rails 3 edition of this trusted collection of solutions, 
    completely revised by Rails master Chad Fowler.
  },
  image_url: '/assets/books/recipes.jpg',
  price: 24.95,
  category_id: Category.find_by_name('Ruby on Rails').id
)

Product.create(
  title: 'Agile Web Development with Rails (4th edition)',
  description: %{
    Rails just keeps on changing. Rails 3 and Ruby 1.9 bring hundreds of improvements, 
    including new APIs and substantial performance enhancements. 
    The fourth edition of this award-winning classic has been reorganized and refocused 
    so it is more useful than ever before for developers new to Ruby and Rails.
  },
  image_url: '/assets/books/rails.jpg',
  price: 28.40,
  category_id: Category.find_by_name('Ruby on Rails').id,
  promote: true
)

vim = Product.create(
  title: 'Practical Vim: Edit Text at the Speed of Thought',
  description: %{
    Vim is a fast and efficient text editor that will make you a faster and more efficient developer. 
    It is available on almost every OS if you master the techniques in this book, you will never need another text editor. 
    In more than 100 Vim tips, you will quickly learn the editor core functionality and tackle your trickiest editing and writing tasks.
  },
  image_url: '/assets/books/vim.jpg',
  price: 38.50,
  category_id: Category.find_by_name('Unix').id,
  promote: true
)

Product.create(
  title: 'The Pragmatic Programmer: From Journeyman to Master',
  description: %{
    Straight from the programming trenches, The Pragmatic Programmer: From Journeyman to Master cuts through the increasing 
    specialization and technicalities of modern software development to examine the core process what do you do, as an individual 
    and as a team, if you want to create software that is easy to work with and good for your users.
  },
  image_url: '/assets/books/prag.jpg',
  price: 29.00,
  category_id: Category.find_by_name('Development').id,
  promote: true
)

unix = Product.create(
  title: 'Working with Unix Processes',
  description: %{
    Take advantage of system programming techniques without toiling away in C. If you program for the web, 
    you might be missing some fundamentals in the name of getting stuff working. Now you can fill that gap. 
    In Working With Unix Processes, you will reuse decades of battle tested, highly optimized, and proven techniques to put your system to work for you.
  },
  image_url: '/assets/books/process.jpg',
  price: 27.00,
  category_id: Category.find_by_name('Unix').id,
  promote: true
)

Product.create(
  title: 'The Passionate Programmer',
  description: %{
    This book is about creating a remarkable career in software development. In most cases, remarkable careers don't 
    come by chance. They require thought, intention, action, and a willingness to change course when you've made mistakes. 
    Most of us have been stumbling around letting our careers take us where they may. It's time to take control. 
    This revised and updated second edition lays out a strategy for planning and creating a radically successful life in software development.
  },
  image_url: '/assets/books/passion.jpg',
  price: 29.95,
  category_id: Category.find_by_name('Development').id,
  promote: true
)

android = Product.create(
  title: 'Rapid Android Development',
  description: %{
    Create mobile apps for Android phones and tablets faster and more easily than you ever imagined. 
    Use "Processing," the free, award winning, graphics savvy language and development environment, to work with the touchscreens, 
    hardware sensors, cameras, network transceivers, and other devices and software in the latest Android phones and tablets.
  },
  image_url: '/assets/books/android.jpg',
  price: 41.00,
  category_id: Category.find_by_name('Android').id,
  promote: false
)

lamp = Product.create(
  title: 'Fulcrum Multi-Flex LED Task Light',
  description: %{
    The Fulcrum MultiFlex Reading Light is an all-purpose reading, task, or travel light with an ultra-bright LED for extended, 
    energy-efficient illumination. This hands-free lamp provides an glare-free light that stays where you put it, 
    thanks to the flexible neck and sturdy clamp. Designed for both home and on-the-go use, the MultiFlex Reading Light is great 
    for clipping to books, e-readers, laptops, and tables. And because the LED bulb never burns out, you'll save on replacement bulb costs. 
      The MultiFlex takes three AAA batteries (not included).
  },
  image_url: '/assets/books/lamp.jpg',
  price: 9.60,
  category_id: Category.find_by_name('Addons').id,
  promote: false
)

tux = Product.create(
  title: 'Sitting Penguin Stress Toy',
  description: %{
    This sitting penguin is so dang cute and contented that he can add a sense of 
    calm to your office life. When you feel some stress coming on, pick him up and give him a 
    squeeze - but remember he might've just finished a large meal of fresh herring
  },
  image_url: '/assets/books/tux.jpg',
  price: 5.90,
  category_id: Category.find_by_name('Addons').id,
  promote: false
  
)

droid = Product.create(
  title: 'Android Plush Figure',
  description: %{
    Collectible plush of the Android mascot, a must have for any Android fan.
  },
  image_url: '/assets/books/droid.jpg',
  price: 6.90,
  category_id: Category.find_by_name('Addons').id,
  promote: false
  
)

Product.create(
  title: 'Learning PHP, MySQL, JavaScript, and CSS: A Step-by-Step Guide to Creating Dynamic Websites',
  description: %{
    If you're familiar with HTML, using the information in Learning PHP, MySQL, JavaScript and CSS, you 
    will quickly learn how to build interactive, data-driven websites with the powerful combination of 
    PHP, MySQL, JavaScript and CSS - the top technologies for creating modern sites. This hands-on guide 
    explains each technology separately, shows you how to combine them, and introduces valuable web programming 
    concepts such as objects, XHTML, cookies, and session management.
    Carefully paced for non-programmers, this second edition of the top-selling guide to web development 
    now also provides an extensive introduction to CSS, and benefits from reader questions and suggestions 
    about the first edition, making the new edition even easier to follow and more information-packed than ever.
    Plus, to ensure your have understood all the main points, you'll practice what you've learned with review 
    questions at the end of each chapter, and there's even a sample social networking platform built with the 
    elements introduced in this book.

  },
  image_url: '/assets/books/oreily.jpg',
  price: 24.90,
  category_id: Category.find_by_name('PHP').id,
  promote: false
  
)

Product.create(
  title: 'PHP Solutions: Dynamic Web Design Made Easy',
  description: %{
    This is a "must have" reference book for any Web developer using PHP scripting language. 
    If you have read the first edition classic, then this update will bring you the latest PHP 
    techniques and best practices. If you are new to dynamic web design with PHP, then David will 
    introduce you to the core techniques and methods for dynamic PHP web sites, ready for the 
    21st century!
  },
  image_url: '/assets/books/phpsolutions.jpg',
  price: 29.90,
  category_id: Category.find_by_name('PHP').id,
  promote: false
  
)

Product.create(
  title: 'PHP and MySQL Web Development',
  description: %{
    PHP and MySQL are popular open-source technologies that are ideal for quickly developing 
    database-driven Web applications. PHP is a powerful scripting language designed to enable 
    developers to create highly featured Web applications quickly, and MySQL is a fast, reliable 
    database that integrates well with PHP and is suited for dynamic Internet-based applications.
    PHP and MySQL Web Development shows how to use these tools together to produce effective, interactive 
    Web applications. It clearly describes the basics of the PHP language, explains how to set up and 
    work with a MySQL database, and then shows how to use PHP to interact with the database and the server.
    This practical, hands-on book includes numerous examples that demonstrate common tasks such as 
    authenticating users, constructing a shopping cart, generating PDF documents and images dynamically, 
    sending and managing email, facilitating user discussions, connecting to Web services using XML, 
    and developing Web 2.0 applications with Ajax-based interactivity.
  },
  image_url: '/assets/books/phpandmysql.jpg',
  price: 36.80,
  category_id: Category.find_by_name('PHP').id,
  promote: false
  
)


android.addons << lamp
android.addons << droid
unix.addons << tux
vim.addons << tux


User.delete_all
User.create(name: 'admin', password: 'password')

Order.delete_all
Cart.delete_all
LineItem.delete_all
Checkout.delete_all

